import Layout from "@/layout/layout"

import HuanWei from "@/views/huanwei"

import Index from "@/views/index"
import Repair from "@/views/workspace/repair"

import Settlement from "@/views/workspace/settlement"
import Parts from "@/views/workspace/settlement/parts"
import PickInfo from "@/views/workspace/settlement/pick_info"
import TruckInfo from "@/views/workspace/settlement/truck_info"
import TruckBasicInfo from "@/views/workspace/settlement/truck_basic_info"
import AllImages from "@/views/workspace/settlement/all_images"

import Work_order from "@/views/workspace/work_order"
import Complete from "@/views/workspace/complete"

import MobileHuanwei from "@/views/mobile/huanwei"


export const views = [
  {
    path:"/",
    redirect:"/huanwei",
  },
  {
    path:"/huanwei",
    component:HuanWei,
    name:"huanwei"
  },
  {
    path:"/main",
		name:"layout",
    redirect:"/main/index",
    component:Layout,
    children:[
      {
        path:"/main/index",
				name:"index",
        component:Index
      },
      {
        path:"/main/repair",
				name:"repair",
        component:Repair
      },
      {
        path:"/main/settlement",
        component:Settlement,
				name:"settlement",
				redirect:"/main/settlement/parts",
				children:[
					{
						path:"/main/settlement/parts",
						component:Parts,
						name:"parts"
					},
					{
						path:"/main/settlement/pick_info",
						component:PickInfo,
						name:"pickInfo"
					},
					{
						path:"/main/settlement/truck_info",
						component:TruckInfo,
						name:"truckInfo"
					},
					{
						path:"/main/settlement/truck_basic_info",
						component:TruckBasicInfo,
						name:"truckBasicInfo"
					},
					{
						path:"/main/settlement/all_images",
						component:AllImages,
						name:"allImages"
					},
				]
      },
      {
        path:"/main/work_order",
				name:"work_order",
        component:Work_order,
      },
      {
        path:"/main/complete",
        component:Complete,
        name:"complete"
      },
    ]
  },
  {
    path:"/mobile/huanwei",
    name:"mobile_huanwei",
    component:MobileHuanwei,
    beforeEnter:(to,from,next) => {
      //电脑打开手机端拦截回电脑端
      let flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
      next(true)
      if(!flag) {
        next({path:'/huanwei'})
      }
    }
  }
  
]